﻿// See https://aka.ms/new-console-template for more information

using System.Threading.Channels;

double number1, number2;

// 读取第一个 double 数字
Console.WriteLine("请输入第一个数字:");
string input1 = Console.ReadLine();
while (!double.TryParse(input1, out number1))
{
    Console.WriteLine("输入无效，请输入一个有效的 double 数字:");
    input1 = Console.ReadLine();
}

// 读取第二个 double 数字
Console.WriteLine("请输入第二个数字:");
string input2 = Console.ReadLine();
while (!double.TryParse(input2, out number2))
{
    Console.WriteLine("输入无效，请输入一个有效的 double 数字:");
    input2 = Console.ReadLine();
}

// 读取运算符
Console.WriteLine("请输入运算符:");
double output = 0.0;
string input3 = Console.ReadLine();
F:
switch (input3)
{ 
    case "+":
        output = number1 + number2; break;
    case "-":
        output = number1 + number2; break;
    case "*":
        output = number1 * number2; break;
    case "/":
        output = number1 / number2; break;
    case "%":
        output = number1 % number2; break;
    default:
        Console.WriteLine("错误的运算符");
        goto F;
        break;
}
Console.WriteLine(output);
   